import axios from '@/utils/http';
import base from './base';

export default {
  // 获取申请公开的空间的列表
  index(params) {
    return axios.get(
      `${base.sq}/product_applies`,
      {
        params: {
          state: params.state,
          page: params.page,
        },
      },
    );
  },
  // 提交申请
  create(params) {
    return axios.post(
      `${base.sq}/product_applies`,
      {
        product_id: params.spaceId,
        content: params.content,
      },
    );
  },
  // 查看申请
  show(params) {
    return axios.get(
      `${base.sq}/product_applies/${params.applyId}`,
    );
  },
  // 操作
  update(params) {
    return axios.put(
      `${base.sq}/product_applies/${params.applyId}`,
      {
        state: params.state,
        reply: params.reply,
      },
    );
  },
};
